﻿namespace System.ServiceModel.DomainServices.Client
{
    using System;
    using System.Runtime.CompilerServices;

    public sealed class DomainException : Exception
    {
        private string stackTrace;

        public DomainException()
        {
        }

        public DomainException(string message) : base(message)
        {
        }

        public DomainException(string message, Exception innerException) : base(message, innerException)
        {
        }

        public DomainException(string message, int errorCode) : this(message)
        {
            this.ErrorCode = errorCode;
        }

        public DomainException(string message, int errorCode, Exception innerException) : base(message, innerException)
        {
            this.ErrorCode = errorCode;
        }

        public DomainException(string message, int errorCode, string stackTrace) : this(message, errorCode)
        {
            this.stackTrace = stackTrace;
        }

        public int ErrorCode { get; set; }

        public override string StackTrace
        {
            get
            {
                return (this.stackTrace ?? base.StackTrace);
            }
        }
    }
}

